<?php 
namespace Modules\ShopApi\Http\Controllers\v1;
use Illuminate\Http\Request;
use Modules\AuthAdmin\Http\Requests\CommonIdRequest;
use Modules\ShopApi\Models\ShopCart as ShopCartModel;
use Modules\ShopApi\Models\ShopOrder as ShopOrderModel;
class CartController extends CommonController
{
	/**
	 * @name  加入购物车
	 * @method  POST	
	 * @param product_id int 商品id
	 * @param num int 购买数量
	 * @param specs_id int 商品规格id
	 * @param specs string 已选规格内容
	 * @return  JSON
	 */
    public function add_cart(Request $request)
    { 
        return (new ShopCartModel())->add_cart($request->all());
    }
	/**
	 * @name  购物车数量
	 * @method  GET	
	 * @return  JSON
	 */
    public function get_cart_sum(Request $request)
    { 
        return (new ShopCartModel())->get_cart_sum();
    }
	/**
	 * @name  购物车列表
	 * @method  GET	
	 * @return  JSON
	 */
    public function get_cart_list()
    { 
        return (new ShopCartModel())->get_cart_list();
    }
	/**
	 * @name  单选
	 * @method  PUT	
	 * @param id int 购物车表id
	 * @return  JSON
	 */
    public function set_cart_status(CommonIdRequest $request)
    { 
        return (new ShopCartModel())->set_cart_status($request->get('id'));
    }
	
	/**
	 * @name  全选全不选
	 * @method  PUT	
	 * @return  JSON
	 */
    public function set_cart_status_all(Request $request)
    { 
        return (new ShopCartModel())->set_cart_status_all();
    }
	/**
	 * @name  购物车减或加
	 * @method  PUT	
	 * @param id int 购物车表id
	 * @param num int 购买数量
	 * @return  JSON
	 */
    public function set_cart_subtract(CommonIdRequest $request)
    { 
        return (new ShopCartModel())->set_cart_subtract($request->all());
    }
	/**
	 * @name  购物车删除
	 * @method  DELETE	
	 * @return  JSON
	 */
    public function cart_delete(Request $request)
    { 
        return (new ShopCartModel())->cart_delete();
    }
	/**
	 * @name  购物车提交订单页
	 * @method  GET
	 * @return  JSON
	 */
    public function get_cart_submit_order(Request $request)
    {
		return (new ShopOrderModel())->get_cart_submit_order();
    }
	/**
	 * @name  购物车提交订单支付
	 * @method  POST  
	 * @param  comment string 备注
	 * @return  JSON
	 */
    public function submit_cart_order_pay(Request $request)
    {
		return (new ShopOrderModel())->submit_cart_order_pay($request->all());
    }
}
